package com.kuzan.autocloud.common.model.menu;

import com.kuzan.autocloud.common.model.Base;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

/**
 * <p>Description: 菜单组</p>
 *
 * @author kuzank 2019/12/1
 */
@Data
@NoArgsConstructor
@Entity
@Table(name = "sys_menu_group")
public class MenuGroup extends Base {

    @Column(length = 32)
    private String icon;
    @Column(length = 32)
    private String belong;
    /**
     * MenuPermissionScope 菜单权限范围
     */
    @Column(length = 32)
    private String mps;


    public static MenuGroup of(String title, String id, String belong, String icon, MenuRoot.MenuPermissionScope mps) {
        MenuGroup obj = new MenuGroup();
        obj.setId(id);
        obj.setTitle(title);
        obj.setBelong(belong);
        obj.setMps(mps.getName());
        obj.setIcon(icon);
        return obj;
    }
}
